Skip to content

Conversation

@aryamohanan
Copy link
Contributor

@aryamohanan aryamohanan commented Oct 3, 2025

Which problem is this PR solving?

This PR fixes an issue in the Redis instrumentation for MULTI (transaction) commands where spans were not correctly handled for mixed command sets.

Previously, the MULTI span did not follow the semantic conventions and could not accurately represent it in the span data

According to this part of the semantic conventions:

db.operation.name: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. For transactions and pipelined calls, if the individual operations are known to have the same command then that command SHOULD be used prepended by MULTI or PIPELINE. Otherwise db.operation.name SHOULD be MULTI or PIPELINE.

Short description of the changes

  • Updated the db.operation.name on the MULTI span:

    • Set to MULTI GET when all operations are GET.
    • Set to MULTI when commands are mixed, in compliance with the semantic conventions.
  • Added support for execAsPipeline, so that when MULTI is executed with execAsPipeline, it is treated as a pipeline in Redis instrumentation.

  • Expanded tests to cover multiple command scenarios.

Related issue: #3082

@aryamohanan aryamohanan force-pushed the fix-redis-multi-spans branch from 2dbf32e to fedac52 Compare October 3, 2025 08:23
@aryamohanan aryamohanan marked this pull request as ready for review October 3, 2025 08:59
@aryamohanan aryamohanan requested a review from a team as a code owner October 3, 2025 08:59
@aryamohanan
Copy link
Contributor Author

@pichlermarc Could you please take a look at this PR?

I’ve updated the Redis instrumentation to handle MULTI and pipeline spans according to the semantic conventions. Specifically:

  • Updated the db.operation.name on the MULTI span:

    • MULTI GET when all operations are GET.

    • MULTI when commands are mixed.

  • Added support for execAsPipeline, so that when MULTI is executed with execAsPipeline, it is treated as a pipeline in Redis instrumentation.

@aryamohanan
Copy link
Contributor Author

@blumamir Could you please take a look at this PR?

@pichlermarc pichlermarc self-assigned this Oct 15, 2025
Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay.

I think the attribute should only be added to the span when the stability opt-in flag is set to stable since it's only part of the latest semconv (the old semconv is 1.7.0, it did not have db.operaration.name). Other than that this PR looks great 🙌

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@pichlermarc pichlermarc merged commit cd37fd4 into open-telemetry:main Nov 12, 2025
23 checks passed
@otelbot
Copy link
Contributor

otelbot bot commented Nov 12, 2025

Thank you for your contribution @aryamohanan! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants